<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
    <script src="js/index.js"></script>
    <script src="js/axios.js"></script>
    <style>


        .el-aside {
            background-color: #D3DCE6;
            color: #333;
            text-align: center;
            line-height: 20px;
            height: auto;
            border: saddlebrown 2px solid;
        }

        .el-dialog, .is-fullscreen .el-dialog__body {
            height: 100%;
        }

        .el-main {
            background-color: #E9EEF3;
            color: #333;
            text-align: center;
            line-height: 160px;
            height: auto;
            border: saddlebrown 2px solid;
        }

    </style>


</head>
<body>
<div id="app" style="overflow:scroll;">

    <el-button type="primary" @click="selectrubric()">选题组卷</el-button>


    <!--element表格-->
    <div style="width: 100%;">
        <template>
            <el-table :data="parperList" :row-class-name="tableRowClassName" style=" width: auto">
                &lt;!&ndash;<el-table-column prop="title" label="章节测试标题" :show-overflow-tooltip="true">
            </el-table-column>&ndash;&gt;
                <el-table-column prop="createtime" label="创建时间" :show-overflow-tooltip="true">
                </el-table-column>

                <el-table-column prop="operation" label="操作" align="center" min-width="100">
                    <template slot-scope="scope">
                        <el-button type="primary" round @click="selectsectionparper(scope.row)" size="mini">查看试卷
                        </el-button>
                        <el-button type="danger" round @click="removesectionparper(scope.row)" size="mini">删除试卷
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>

        </template>
    </div>

    <!--查看章节测试试卷-->
    <el-dialog title="查看试卷" :visible.sync="lookparper" width="80%" :before-close="handleClose">

        <div id="parper">
            <font size="5">
                章节测试试卷标题:
            </font>
            <font size="4" color="red">
                {{sectionparpertitle}}
            </font>

            <font size="5">
                试卷总分:
            </font>
            <font size="4" color="red">
                {{sectionparpertotal}}
            </font>


            <br>
            <h2>一.单择题 </h2>
            <hr>
            <ol v-for="site in sites">
            <span v-if="site.rubrictype==='单选题'">
            <li class="cccc" style="margin-left: 20px">
                <h2>({{site.index}})<font size="4">{{site.rubrictype}}</font> :{{site.content}} {{site.score}}分 <font
                        color="red">正确答案:({{site.answer}})</font>
                </h2>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">A:{{site.answerA}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">B:{{site.answerB}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">C:{{site.answerC}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">D:{{site.answerD}}</font>
            </li>
            <br><br>
                </span>
            </ol>

            <h2>一.多选题 </h2>
            <hr>
            <ol v-for="site in sites">

            <span v-if="site.rubrictype==='多选题'">

            <li class="cccc" style="margin-left: 20px">
                <h2>({{site.index}})<font size="4">{{site.rubrictype}}</font> :{{site.content}} {{site.score}}分 <font
                        color="red">正确答案:({{site.answer}})</font>
                </h2>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">A:{{site.answerA}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">B:{{site.answerB}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">C:{{site.answerC}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">D:{{site.answerD}}</font>
            </li>
            <br><br>
                </span>
            </ol>

            <h2>一.填空题 </h2>
            <hr>
            <ol v-for="site in sites">

            <span v-if="site.rubrictype==='填空题'">

            <li class="cccc" style="margin-left: 20px">
                <h2>({{site.index}})<font size="4">{{site.rubrictype}}</font> :{{site.content}} {{site.score}}分 <font
                        color="red">正确答案:({{site.answer}})</font>
                </h2>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">A:{{site.answerA}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">B:{{site.answerB}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">C:{{site.answerC}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">D:{{site.answerD}}</font>
            </li>
            <br><br>
                </span>
            </ol>


            <h2>一.判断题 </h2>
            <hr>
            <ol v-for="site in sites">

            <span v-if="site.rubrictype==='判断题'">

            <li class="cccc" style="margin-left: 20px">
                <h2>({{site.index}})<font size="4">{{site.rubrictype}}</font> :{{site.content}} {{site.score}}分 <font
                        color="red">正确答案:({{site.answer}})</font>
                </h2>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">A:{{site.answerA}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">B:{{site.answerB}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">C:{{site.answerC}}</font>
            </li>
            <li class="cccc" v-if="site.seen">
                <font size="4">D:{{site.answerD}}</font>
            </li>
            <br><br>
                </span>
            </ol>
        </div>

    </el-dialog>


    <!--添加试卷的对话框-->
    <el-dialog title="添加试卷" fullscreen :visible.sync="addparper" width="60%" :before-close="handleClose">
        <el-form :inline="true" :model="ruleForm" :rules="rules" ref="ruleForm" class="demo-form-inline">
            <el-form-item label="试卷标题:" prop="formtitle">
                <el-input v-model="ruleForm.formtitle" style="width:280px;"></el-input>
            </el-form-item>

            <!--<el-form-item label="考试课程:" prop="coursetype">
                <el-select v-model="ruleForm.coursetype" placeholder="请选择" @change="querycourse" size="small">
                    <el-option v-for="item in options3" :key="item.courId" :label="item.courName" :value="item.courId"
                               :disabled="item.disabled">
                    </el-option>
                </el-select>
            </el-form-item>
            <br/>
            <el-form-item label="试卷总分:" prop="formtotal">
                <el-input v-model.number="ruleForm.formtotal" style="width:70px;"></el-input>
            </el-form-item>
            <el-form-item label="考试时常(分钟):" prop="formduration">
                <el-input v-model.number="ruleForm.formduration" style="width:70px;"></el-input>
            </el-form-item>
            <el-form-item label="最低交卷时间(分钟):" prop="formexamshortesttime">
                <el-input v-model.number="ruleForm.formexamshortesttime" style="width:70px;"></el-input>
            </el-form-item>-->

            <el-form-item>
                <el-button type="primary" @click="submitForm('ruleForm')">进入选题</el-button>
                <el-button @click="resetForm()">重置</el-button>
            </el-form-item>
        </el-form>
    </el-dialog>

    <!--添加题的对话框-->
    <el-dialog title="添加题" fullscreen :visible.sync="bigdialog" width="99%" modal="false" :before-close="handleClose">

        <el-container>
            <!--布局-->
            <el-aside width="50%">
                </p>
                <font size="6">教师题库</font>
                </p> </p></p> </p>

                <div style="height: 100px">
                    <!--多条件查询-->
                    <div align="center">

                        <!--<span>题干:</span>-->
                        <font size="4">题干:</font>
                        <el-input v-model="rubric" placeholder="请输入内容" style="width: 100px;" size="small"></el-input>


                        <!--<span size="2">试题的类型:</span>-->
                        <font size="4">试题的类型:</font>
                        <el-select v-model="typecc" placeholder="请选择" style="width: 100px;" size="small">
                            <el-option v-for="item in options2" :key="item.value" :label="item.label"
                                       :value="item.value"
                                       :disabled="item.disabled">
                            </el-option>
                        </el-select>


                        <!--<span size="2">课程:</span>-->
                        <font size="4">课程:</font>
                        <el-select v-model="typecc3" placeholder="请选择" style="width: 100px;" @change="querycourse"
                                   size="small">
                            <el-option v-for="item in options3" :key="item.courId" :label="item.courName"
                                       :value="item.courId"
                                       :disabled="item.disabled">
                            </el-option>
                        </el-select>

                        <el-button type="primary" icon="el-icon-search" @click="query()" v-on:keyup.13="submit"
                                   size="medium"
                                   round>
                            搜索
                        </el-button>

                        </p> </p></p> </p>
                        是否设置默认分值:
                        <el-switch v-model="inittype" active-value="true" inactive-value="false"></el-switch>
                        <el-input v-model="initnum" style="width: 100px;" placeholder="请输入内容"></el-input>


                    </div>
                </div>

                <!--显示试题(供与选择)-->
                <div style="width: 100%;">
                    <template>
                        <el-table :data="rubricList" style=" width: auto">
                            <!--<el-table-column prop="id" label="序号" :show-overflow-tooltip="true">
                            </el-table-column>-->
                            <el-table-column prop="rubricttype" label="试题类型" :show-overflow-tooltip="true">
                            </el-table-column>
                            <el-table-column prop="content" label="题干" :show-overflow-tooltip="true">
                            </el-table-column>
                            <el-table-column prop="A" label="选项A" :show-overflow-tooltip="true">
                            </el-table-column>
                            <el-table-column prop="B" label="选项B" :show-overflow-tooltip="true">
                            </el-table-column>
                            <el-table-column prop="C" label="选项C" :show-overflow-tooltip="true">
                            </el-table-column>
                            <el-table-column prop="D" label="选项D" :show-overflow-tooltip="true">
                            </el-table-column>
                            <!-- <el-table-column prop="sectionId" label="章节id" :show-overflow-tooltip="true">
                             </el-table-column>
                             <el-table-column prop="courseId" label="课程id" :show-overflow-tooltip="true">
                             </el-table-column>-->
                            <!--<el-table-column prop="answerId" label="答案id" :show-overflow-tooltip="true">
                            </el-table-column>-->

                            <el-table-column prop="operation" label="操作" align="center" min-width="100">
                                <template slot-scope="scope">
                                    <el-button type="primary" round @click="checkDetail(scope.row)" size="mini">查看
                                    </el-button>
                                    <el-button type="primary" round @click="addparperrubric(scope.row)" size="mini">
                                        添加
                                    </el-button>

                                </template>
                            </el-table-column>
                        </el-table>

                    </template>
                </div>

                <!--试题分页-->
                <el-pagination class="fy"
                               layout="prev, pager, next"
                               @current-change="current_change"
                               :total="total"
                               :page-size="pagesize"
                               background
                >
                </el-pagination>

                <!--修改填空题的对话框-->
                <el-dialog title="修改填空题" :visible.sync="dialogVisiblepack" :modal="false" width="60%"
                           :before-close="handleClose">

                    <el-form ref="form" :model="form" label-width="80px">
                        <el-form-item label="题干内容:">
                            <el-input v-model="packrubric"></el-input>
                        </el-form-item>

                        <el-form-item label="正确答案:">
                            <el-input v-model="packanswer" style="width:80%"></el-input>
                        </el-form-item>


                        <el-form-item>
                            <el-button type="primary" @click="dialogVisiblepack = false">知道了</el-button>

                        </el-form-item>
                    </el-form>


                </el-dialog>

                <!--修改判断题的对话框-->
                <el-dialog title="修改判断题" :visible.sync="dialogVisiblejudge" :modal="false" width="60%"
                           :before-close="handleClose">

                    <el-form ref="form" :model="form" label-width="80px">
                        <el-form-item label="题干内容:">
                            <el-input v-model="judgerubric"></el-input>
                        </el-form-item>

                        <el-switch v-model="value3" active-text="正确" inactive-text="错误">
                        </el-switch>


                        <el-form-item>
                            <el-button type="primary" @click="dialogVisiblejudge = false">知道了</el-button>

                        </el-form-item>

                    </el-form>
                </el-dialog>

                <!--修改单选题的对话框-->
                <el-dialog title="修改单选题" :visible.sync="dialogVisibleselect" :modal="false" width="60%"
                           :before-close="handleClose">
                    <el-form ref="updateform" :model="updateform" label-width="80px">
                        <el-form-item label="题干内容:">
                            <el-input v-model="inputupdate"></el-input>
                        </el-form-item>

                        <el-form-item label="答案A:">
                            <el-input v-model="inputA" style="width:80%"></el-input>
                            <el-switch v-model="updateform" active-value="A" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案B">
                            <el-input v-model="inputB" style="width:80%"></el-input>
                            <el-switch v-model="updateform" active-value="B" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案C">
                            <el-input v-model="inputC" style="width:80%"></el-input>
                            <el-switch v-model="updateform" active-value="C" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案D">
                            <el-input v-model="inputD" style="width:80%"></el-input>
                            <el-switch v-model="updateform" active-value="D" inactive-value=""></el-switch>
                        </el-form-item>


                        <el-form-item>
                            <el-button type="primary" @click="dialogVisibleselect = false">知道了</el-button>

                        </el-form-item>
                    </el-form>


                </el-dialog>

                <!--修改多选题的对话框-->
                <el-dialog title="修改多选题" :visible.sync="updatedialogVisibleduo" :modal="false" width="60%"
                           :before-close="handleClose">
                    <el-form ref="duoupdateform" :model="duoupdateform" label-width="80px">
                        <el-form-item label="题干内容:">
                            <el-input v-model="duoinputupdate"></el-input>
                        </el-form-item>

                        <el-form-item label="答案A:">
                            <el-input v-model="duoinputA" style="width:80%"></el-input>
                            <el-switch v-model="duoupdateform1" active-value="A" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案B">
                            <el-input v-model="duoinputB" style="width:80%"></el-input>
                            <el-switch v-model="duoupdateform2" active-value="B" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案C">
                            <el-input v-model="duoinputC" style="width:80%"></el-input>
                            <el-switch v-model="duoupdateform3" active-value="C" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案D">
                            <el-input v-model="duoinputD" style="width:80%"></el-input>
                            <el-switch v-model="duoupdateform4" active-value="D" inactive-value=""></el-switch>
                        </el-form-item>


                        <el-form-item>
                            <el-button type="primary" @click="updatedialogVisibleduo = false">知道了</el-button>

                        </el-form-item>
                    </el-form>

                </el-dialog>

                <!--添加题到考试题库中-->
                <el-dialog title="添加题到试卷" :visible.sync="score" :modal="false" width="60%">
                    <el-form ref="scoreform" :model="scoreform" label-width="80px">
                        <el-form-item label="分数:">
                            <el-input v-model="score1"></el-input>
                        </el-form-item>

                        <el-form-item>
                            <el-button type="primary" @click="addparperrubricsave()">添加题到试卷</el-button>
                            <el-button @click="addquxiao()">取消</el-button>
                        </el-form-item>
                    </el-form>

                </el-dialog>


                <!--布局-->
            </el-aside>


            <el-aside width="50%">
                </p>
                <font size="6">当前试卷中的题</font>
                </p> </p></p> </p>

                <div style="height: 100px">
                    <!--多条件-->
                    <div align="center">

                        <el-button type="primary" icon="el-icon-plus" @click="dialogVisibletype = true" size="small"
                                   round>
                            新增试题
                        </el-button>
                        <font size="4">题干:</font>
                        <el-input v-model="examrubric" placeholder="请输入内容" style="width: 100px;" style="width: 150px;"
                                  size="small"></el-input>


                        <font size="4">试题的类型:</font>
                        <el-select v-model="typeccexam" placeholder="请选择" style="width: 100px;" size="small">
                            <el-option v-for="item in options2" :key="item.value" :label="item.label"
                                       :value="item.value"
                                       :disabled="item.disabled">
                            </el-option>
                        </el-select>


                        <el-button type="primary" icon="el-icon-search" @click="queryexam()" v-on:keyup.13="submit"
                                   size="medium"
                                   round>
                            搜索
                        </el-button>
                    </div>
                </div>

                <!--显示试题(供与选择)-->
                <div style="width: 100%;">
                    <template>
                        <el-table :data="examrubricList" style=" width: auto">
                            <!--<el-table-column prop="id" label="序号" :show-overflow-tooltip="true">
                            </el-table-column>-->
                            <el-table-column prop="rubricttype" label="试题类型" :show-overflow-tooltip="true">
                            </el-table-column>
                            <el-table-column prop="content" label="题干" :show-overflow-tooltip="true">
                            </el-table-column>
                            <el-table-column prop="A" label="选项A" :show-overflow-tooltip="true">
                            </el-table-column>
                            <el-table-column prop="B" label="选项B" :show-overflow-tooltip="true">
                            </el-table-column>
                            <el-table-column prop="C" label="选项C" :show-overflow-tooltip="true">
                            </el-table-column>
                            <el-table-column prop="D" label="选项D" :show-overflow-tooltip="true">
                            </el-table-column>
                            <!-- <el-table-column prop="sectionId" label="章节id" :show-overflow-tooltip="true">
                             </el-table-column>
                             <el-table-column prop="courseId" label="课程id" :show-overflow-tooltip="true">
                             </el-table-column>-->
                            <!--<el-table-column prop="answerId" label="答案id" :show-overflow-tooltip="true">
                            </el-table-column>-->

                            <el-table-column prop="operation" label="操作" align="center" min-width="100">
                                <template slot-scope="scope">
                                    <el-button type="primary" round @click="checkDetail(scope.row)" size="mini">查看
                                    </el-button>
                                    <el-button type="primary" round @click="deleteparperrubric(scope.row)" size="mini">
                                        移除
                                    </el-button>

                                </template>
                            </el-table-column>
                        </el-table>

                    </template>
                </div>

                <!--选择新增的试题类型-->
                <el-dialog title="选择新增题型" :visible.sync="dialogVisibletype" :modal="false" width="60%"
                           :before-close="handleClose">
                    <el-button type="primary" icon="el-icon-plus" @click="dialogVisible = true" size="small" round>
                        新增单选题
                    </el-button>
                    <el-button type="primary" icon="el-icon-plus" @click="dialogVisibleduo = true" size="small"
                               round>
                        新增多选题
                    </el-button>
                    <el-button type="primary" icon="el-icon-plus" @click="dialogVisibletk = true" size="small"
                               round>
                        新增填空题
                    </el-button>
                    <el-button type="primary" icon="el-icon-plus" @click="dialogVisiblepd = true" size="small"
                               round>
                        新增判断题
                    </el-button>
                </el-dialog>


                <!--新增单选题对话框-->
                <el-dialog title="新增单选题" :visible.sync="dialogVisible" :modal="false" width="60%"
                           :before-close="handleClose">

                    <el-form ref="form" :model="form" label-width="80px">
                        <el-form-item label="题干内容:">
                            <el-input v-model="addrubric"></el-input>
                        </el-form-item>

                        <el-form-item label="答案A:">
                            <el-input v-model="answerA" style="width:80%"></el-input>
                            <el-switch v-model="form" active-value="A" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案B:">
                            <el-input v-model="answerB" style="width:80%"></el-input>
                            <el-switch v-model="form" active-value="B" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案C:">
                            <el-input v-model="answerC" style="width:80%"></el-input>
                            <el-switch v-model="form" active-value="C" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案D:">
                            <el-input v-model="answerD" style="width:80%"></el-input>
                            <el-switch v-model="form" active-value="D" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="分数:">
                            <el-input v-model="score2" style="width:80%"></el-input>
                        </el-form-item>

                        <!-- <font size="4">课程:</font>
                         <el-select v-model="typedan" placeholder="请选择" @change="querycourse" size="small">
                             <el-option v-for="item in options3" :key="item.courId" :label="item.courName"
                                        :value="item.courId"
                                        :disabled="item.disabled">
                             </el-option>
                         </el-select>-->


                        <el-form-item>
                            <el-button type="primary" @click="addrudic()">立即创建</el-button>
                            <el-button @click="addquxiao()">取消</el-button>
                        </el-form-item>
                    </el-form>

                </el-dialog>

                <!--新增多选题-->
                <el-dialog title="新增多选题" :visible.sync="dialogVisibleduo" :modal="false" width="60%"
                           :before-close="handleClose">

                    <el-form ref="formduo" :model="formduo" label-width="80px">
                        <el-form-item label="题干内容:">
                            <el-input v-model="duoaddrubric"></el-input>
                        </el-form-item>

                        <el-form-item label="答案A:">
                            <el-input v-model="duoanswerA" style="width:80%"></el-input>
                            <el-switch v-model="duoform1" active-value="A" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案B">
                            <el-input v-model="duoanswerB" style="width:80%"></el-input>
                            <el-switch v-model="duoform2" active-value="B" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案C">
                            <el-input v-model="duoanswerC" style="width:80%"></el-input>
                            <el-switch v-model="duoform3" active-value="C" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="答案D">
                            <el-input v-model="duoanswerD" style="width:80%"></el-input>
                            <el-switch v-model="duoform4" active-value="D" inactive-value=""></el-switch>
                        </el-form-item>

                        <el-form-item label="分数:">
                            <el-input v-model="score2" style="width:80%"></el-input>
                        </el-form-item>

                        <!--<font size="4">课程:</font>
                        <el-select v-model="typeduo" placeholder="请选择" @change="querycourse" size="small">
                            <el-option v-for="item in options3" :key="item.courId" :label="item.courName"
                                       :value="item.courId"
                                       :disabled="item.disabled">
                            </el-option>
                        </el-select>-->


                        <el-form-item>
                            <el-button type="primary" @click="addrudicduo()">立即创建</el-button>
                            <el-button @click="addquxiao()">取消</el-button>
                        </el-form-item>
                    </el-form>

                </el-dialog>

                <!--新增填空题对话框-->
                <el-dialog title="新增填空题" :visible.sync="dialogVisibletk" :modal="false" width="60%"
                           :before-close="handleClose">

                    <el-form ref="form" :model="form" label-width="80px">

                        <el-form-item label="题干内容:">
                            <el-input v-model="tkaddrubric"></el-input>
                        </el-form-item>

                        <el-form-item label="正确答案:">
                            <el-input v-model="tkaddanswer"></el-input>
                        </el-form-item>

                        <el-form-item label="分数:">
                            <el-input v-model="score2" style="width:80%"></el-input>
                        </el-form-item>

                        <!-- <font size="4">课程:</font>
                         <el-select v-model="typebletk" placeholder="请选择" @change="querycourse" size="small">
                             <el-option v-for="item in options3" :key="item.courId" :label="item.courName"
                                        :value="item.courId"
                                        :disabled="item.disabled">
                             </el-option>
                         </el-select>-->

                        <el-form-item>
                            <el-button type="primary" @click="tkaddrudic()">立即创建</el-button>
                            <el-button @click="addquxiao()">取消</el-button>
                        </el-form-item>
                    </el-form>

                </el-dialog>

                <!--新增判断题对话框-->
                <el-dialog title="新增判断题" :visible.sync="dialogVisiblepd" :modal="false" width="60%"
                           :before-close="handleClose">

                    <el-form ref="form" :model="form" label-width="80px">
                        <el-form-item label="题干内容:">
                            <el-input v-model="pdaddrubric"></el-input>
                        </el-form-item>

                        <el-switch v-model="pdvalue3" active-text="正确" inactive-text="错误">
                        </el-switch>

                        <el-form-item label="分数:">
                            <el-input v-model="score2" style="width:80%"></el-input>
                        </el-form-item>

                        <!--<font size="4">课程:</font>
                        <el-select v-model="typejudge" placeholder="请选择" @change="querycourse" size="small">
                            <el-option v-for="item in options3" :key="item.courId" :label="item.courName"
                                       :value="item.courId"
                                       :disabled="item.disabled">
                            </el-option>
                        </el-select>-->


                        <el-form-item>
                            <el-button type="primary" @click="pdaddrudic()">立即创建</el-button>
                            <el-button @click="addquxiao()">取消</el-button>
                        </el-form-item>
                    </el-form>

                </el-dialog>

                <!--试题分页-->
                <el-pagination class="fy"
                               layout="prev, pager, next"
                               @current-change="current_changeexam"
                               :total="totalexam"
                               :page-size="pagesize"
                               background
                >
                </el-pagination>


            </el-aside>
        </el-container>

        <div>
            <el-button type="primary" @click="addparperanniu()" style="float: right" size="mini">立即创建</el-button>
        </div>

    </el-dialog>


</div>
</body>
<script>

    /*自动在请求中添加请求头*/
    axios.defaults.headers.common['Authorization'] = "bearer " + sessionStorage.getItem("access_token");
    /*获取登陆人的userid*/
    var userid = sessionStorage.getItem("userid");

    var sessionid = localStorage.getItem("chaId");

    var courid = localStorage.getItem("courId");


    var main = new Vue({
        el: '#app',

        /*初始化方法放在这里面(相当于页面加载事件)*/
        mounted: function () {
            this.querycourse();
            this.queryparper();
        },
        /*数据*/
        data() {
            return {
                options2: [
                    {
                        value: '',
                        label: '请选择'
                    },
                    {
                        value: '单选题',
                        label: '单择题'
                    }, {
                        value: '多选题',
                        label: '多选题'
                    }
                    , {
                        value: '填空题',
                        label: '填空题'
                    }, {
                        value: '判断题',
                        label: '判断题'
                    }],
                value: '',
                parperList: [],
                lookparper: false,
                sites: [],
                sectionparpertitle: "",
                sectionparpertotal: "",
                inittype: "",
                initnum: 0,


                ruleForm: {
                    formtitle: '',
                    coursetype: '',
                    formtotal: '',
                    formduration: '',
                    formexamshortesttime: '',
                    examrubric: "",


                },
                score2: "",

                updateform: {},
                inputupdate: '',
                inputA: '',
                inputB: '',
                inputC: '',
                inputD: '',
                bigdialog: false,
                addparper: false,


                updateform: true,
                form: {},
                addrubric: '',
                answerA: "",
                answerB: "",
                answerC: "",
                answerD: "",
                form: true,
                typejudge: "",
                typeduo: "",
                typedan: "",
                typebletk: "",

                scoreform: {},


                formduo: {},
                duoaddrubric: "",
                duoanswerA: "",
                duoanswerB: "",
                duoanswerC: "",
                duoanswerD: "",
                duoform1: "",
                duoform2: "",
                duoform3: "",
                duoform4: "",

                duoupdateform: {},
                duoinputupdate: "",
                duoinputA: '',
                duoinputB: '',
                duoinputC: '',
                duoinputD: '',
                duoupdateform1: "",
                duoupdateform2: "",
                duoupdateform3: "",
                duoupdateform4: "",


                pdvalue3: '',
                score: false,
                score1: "",
                rubric: "",
                typecc: "",
                typeccexam: '',
                typecc3: "",
                total: 50,//默认数据总数
                pagesize: 10,//每页的数据条数
                currentPage: 1,//默认开始页面
                rubricList: [],
                examrubricList: [],
                examrubric: '',

                dialogVisibleselect: false,
                dialogVisiblejudge: false,
                dialogVisiblepack: false,
                dialogVisibletype: false,
                dialogVisibletk: false,
                dialogVisiblepd: false,
                dialogVisibleduo: false,
                dialogVisible: false,
                updatedialogVisibleduo: false,
                addparper: false,


                parperid: "",


            }
        },

        /*方法函数写在这里面*/
        methods: {

            /*点击查看试题的的时候调用这个(选择题显示选择题的对话框,填空题显示填空的,判断显示判断的)*/
            checkDetail(val) {

                /*alert(val.answerId);*/

                this.id = val.id;
                this.answerid = val.answerId;
                this.inputupdate = val.content;
                this.type = val.rubricttype;
                this.inputA = val.A;
                this.inputB = val.B;
                this.inputC = val.C;
                this.inputD = val.D;
                this.aaaa = val.Aid;
                this.bbbb = val.Bid;
                this.cccc = val.Cid;
                this.dddd = val.Did;
                this.list = val;

                if (val.rubricttype == "单选题") {
                    this.dialogVisibleselect = true;

                    if (val.answerId == val.Aid) {
                        window.setTimeout(() => {
                            this.updateform = "A";
                        }, 1)
                    } else if (val.answerId == val.Bid) {
                        window.setTimeout(() => {
                            this.updateform = "B";
                        }, 1)
                    } else if (val.answerId == val.Cid) {
                        window.setTimeout(() => {
                            this.updateform = "C";
                        }, 1)
                    } else if (val.answerId == val.Did) {
                        window.setTimeout(() => {
                            this.updateform = "D";
                        }, 1)
                    } else {
                        this.updateform = "";
                    }
                } else if (val.rubricttype == "多选题") {
                    this.duoinputA = val.A;
                    this.duoinputB = val.B;
                    this.duoinputC = val.C;
                    this.duoinputD = val.D;
                    this.duoinputupdate = val.content;

                    var result = val.answerId.split(",");
                    for (var i = 0; i < result.length; i++) {

                        if (result[i] == val.Aid) {
                            window.setTimeout(() => {
                                this.duoupdateform1 = "A";
                            }, 1)
                        }

                        if (result[i] == val.Bid) {
                            window.setTimeout(() => {
                                this.duoupdateform2 = "B";
                            }, 1)
                        }
                        if (result[i] == val.Cid) {
                            window.setTimeout(() => {
                                this.duoupdateform3 = "C";
                            }, 1)
                        }
                        if (result[i] == val.Did) {
                            window.setTimeout(() => {
                                this.duoupdateform4 = "D";
                            }, 1)
                        }
                    }
                    this.updatedialogVisibleduo = true;


                }
                else if (val.rubricttype == "填空题") {


                    this.dialogVisiblepack = true;
                    this.packrubric = val.content;
                    this.packanswer = val.answerId;


                } else if (val.rubricttype == "判断题") {
                    this.judgerubric = val.content

                    if (val.answerId == "正确") {
                        this.value3 = true;
                    } else if (val.answerId == "错误") {
                        this.value3 = false;
                    }
                    this.dialogVisiblejudge = true;

                }


            },
            /*根据课程id章节id查询所有的章节试卷*/
            queryparper() {
                let params = new URLSearchParams();
                params.append("course", courid);
                params.append("section", sessionid);
                axios({
                    method: 'post',
                    url: '/api/exam/sectionparper/querysectionparper',
                    data: params,

                }).then(res => {

                    res = res.data;
                    this.parperList = res;
                })

            },

            /*根据根据课程id,章节idd 测试试卷id 删除章节测试试卷*/
            removesectionparper(val) {
                let params = new URLSearchParams();
                params.append("course", courid);
                params.append("section", sessionid);
                params.append("parperid", val.id);

                axios({
                    method: 'post',
                    url: '/api/exam/sectionparper/deletsectionforcourseidandsectionidparperid',
                    data: params,

                }).then(res => {
                    res = res.data;
                    if (res.success) {
                        this.$notify({title: "成功", message: res.message, type: 'success'});
                        this.queryparper();
                    } else {
                        this.$notify.error({title: "失败", message: res.message})
                    }

                })

            },

            /*添加试卷*/
            selectrubric() {
                this.addparper = true;
            },
            /*查看章节测试试卷*/
            selectsectionparper(val) {
                this.lookparper = true;
                /**
                 * 试卷信息
                 */
                this.sectionparpertitle = val.title;
                this.sectionparpertotal = val.total;
                let params = new URLSearchParams();

                params.append("parperid", val.id);

                axios({
                    method: 'post',
                    url: '/api/exam/sectionparper/selectsectionparperrubric',
                    data: params,

                }).then(res => {
                    res = res.data;
                    this.sites = res;


                })


            },

            /*根据userid查询所拥有的课程*/
            querycourse: function () {
                axios({
                    method: 'get',
                    url: '/api/exam/rubric/getcourser',
                    params: {
                        teaId: userid,
                    },

                }).then(res => {
                    res = res.data;
                    this.options3 = res.message;

                })


            },

            /*点击创建的时候*/
            submitForm() {

                let params = new URLSearchParams();
                params.append("title", this.ruleForm.formtitle);//考试标题
                params.append("subject", courid)//考试课程id
                params.append("sectionId", sessionid);//章节测试id

                //params.append("examshortesttime", this.ruleForm.formexamshortesttime);//考试最短交卷时间
                //params.append("total", this.ruleForm.formtotal);//考试总分
                //params.append("duration", this.ruleForm.formduration);//考试时长


                axios({
                    method: 'post',
                    url: '/api/exam/examparper/addsesionparper',
                    data: params,

                }).then(res => {

                    res = res.data;
                    if (res.success) {
                        this.addparper = false;
                        this.bigdialog = true;
                        this.parperid = res.remark;
                        this.query();
                        this.queryexam();

                    } else {
                        this.$notify.error({title: "失败", message: res.message});
                    }

                })


            },

            /*重置按钮触发事件*/
            resetForm() {
                this.ruleForm.formtitle = "";
                this.ruleForm.coursetype = "";
                this.ruleForm.formexamshortesttime = "";
                this.ruleForm.formtotal = "";
                this.ruleForm.formduration = "";
            },

            /*获取所有试题方法*/
            query() {

                let params = new URLSearchParams();
                params.append("userid", userid);
                params.append("page", this.currentPage);
                params.append("rows", this.pagesize);
                params.append("rubric", this.rubric);
                params.append("type", this.typecc);//试题类型
                /* params.append("course", this.course);*/
                /*params.append("section", this.section);*/
                params.append("coursetype", this.typecc3);


                axios({
                    method: 'post',
                    url: '/api/exam/rubric/queryrubricer',
                    data: params,

                }).then(res => {

                    res = res.data;

                    for (let i = 0; i < res.page.length; i++) {
                        let r = res.page[i];
                        let answer = r.answer;
                        for (let j = 0; j < answer.length; j++) {
                            let a = answer[j];
                            r[a.optiones] = a.content;
                            r[a.optiones + "id"] = a.id;
                        }
                    }
                    this.rubricList = res.page;
                    this.total = res.total;


                })

            },

            /*获取所有章节测试试题方法*/
            queryexam() {
                let params = new URLSearchParams();
                params.append("examparper", this.parperid);
                params.append("userid", userid);
                params.append("page", this.currentPage);
                params.append("rows", this.pagesize);
                params.append("rubric", this.examrubric);
                params.append("type", this.typeccexam);//试题类型


                params.append("coursetype", this.typecc3);

                axios({
                    method: 'post',
                    url: '/api/exam/Sectionrubric/querysectionrubric',
                    data: params,

                }).then(res => {

                    res = res.data;

                    for (let i = 0; i < res.page.length; i++) {
                        let r = res.page[i];
                        let answer = r.examanswers;
                        for (let j = 0; j < answer.length; j++) {
                            let a = answer[j];
                            r[a.optiones] = a.content;
                            r[a.optiones + "id"] = a.id;
                        }
                    }
                    this.examrubricList = res.page;
                    this.totalexam = res.total;


                })

            },

            /*随机组卷点击添加试题的时候触发*/
            addparperrubric(val) {
                if (this.inittype == "false") {
                    this.score = true;
                } else {
                    {
                        let params = new URLSearchParams();
                        params.append("userid", userid);//用户id
                        params.append("rubrictype", val.rubricttype);//题干类型
                        params.append("score", this.initnum);//分数

                        params.append("answerA", val.A);//答案
                        params.append("answerB", val.B);
                        params.append("answerC", val.C);

                        params.append("answerD", val.D);
                        params.append("Aid", val.Aid);//答案的id
                        params.append("Bid", val.Bid);

                        params.append("Cid", val.Cid);
                        params.append("Did", val.Did);
                        params.append("addrubric", val.content);//题干

                        params.append("answerid", val.answerId);//答案id
                        params.append("parperid", this.parperid);
                        params.append("course", courid);
                        params.append("sectionid", sessionid);


                        axios({
                            method: 'post',
                            url: '/api/exam/Sectionrubric/addexamrubric',
                            data: params,

                        }).then(res => {
                            res = res.data;
                            if (res.success) {

                                this.$notify({title: "成功", message: res.message, type: 'success'});
                                /*新建成功之后刷新试卷拥有的题干表table*/

                                this.score = false;
                                this.score1 = "";
                                this.queryexam();

                            } else {
                                this.$notify.error({title: "失败", message: res.message})
                            }


                        })


                    }
                }

                this.list = val;
            },

            /*点击创建试卷()最后的创建试卷*/
            addparperanniu() {


                let params = new URLSearchParams();
                params.append("parperid", this.parperid);//用户id

                axios({
                    method: 'post',
                    url: '/api/exam/sectionparper/endsectionparper',
                    data: params,

                }).then(res => {
                    res = res.data;
                    if (res.success) {

                        this.$notify({title: "成功", message: res.message, type: 'success'});
                        this.bigdialog = false;
                        this.addparper = false;
                        this.queryparper();


                    } else {
                        this.$notify.error({title: "失败", message: res.message})
                    }


                })
            },

            /*点击卷子中的题上的移除按钮*/
            deleteparperrubric(val) {

                let params = new URLSearchParams();
                params.append("examrubricid", val.id);//用户id


                axios({
                    method: 'post',
                    url: '/api/exam/examrubric/deleteexamrubric',
                    data: params,

                }).then(res => {
                    res = res.data;
                    if (res.success) {

                        this.$notify({title: "成功", message: res.message, type: 'success'});
                        /*新建成功之后刷新试卷拥有的题干表table*/
                        this.queryexam();

                    } else {
                        this.$notify.error({title: "失败", message: res.message})
                    }


                })


            },

            /*选的题点击保存的时候*/
            addparperrubricsave() {

                let params = new URLSearchParams();
                params.append("userid", userid);//用户id
                params.append("rubrictype", this.list.rubricttype);//题干类型
                params.append("score", this.score1);//分数

                params.append("answerA", this.list.A);//答案
                params.append("answerB", this.list.B);
                params.append("answerC", this.list.C);

                params.append("answerD", this.list.D);
                params.append("Aid", this.list.Aid);//答案的id
                params.append("Bid", this.list.Bid);

                params.append("Cid", this.list.Cid);
                params.append("Did", this.list.Did);
                params.append("addrubric", this.list.content);//题干

                params.append("answerid", this.list.answerId);//答案id
                params.append("parperid", this.parperid);
                params.append("course", courid);
                params.append("sectionid", sessionid);


                axios({
                    method: 'post',
                    url: '/api/exam/Sectionrubric/addexamrubric',
                    data: params,

                }).then(res => {
                    res = res.data;
                    if (res.success) {

                        this.$notify({title: "成功", message: res.message, type: 'success'});
                        /*新建成功之后刷新试卷拥有的题干表table*/

                        this.score = false;
                        this.score1 = "";
                        this.queryexam();

                    } else {
                        this.$notify.error({title: "失败", message: res.message})
                    }


                })


            },


            /*新增单选题方法*/
            addrudic() {
                let params = new URLSearchParams();
                params.append("rubrictype", "单选题");
                params.append("userid", userid);
                params.append("answerid", this.form);
                params.append("addrubric", this.addrubric);
                params.append("answerA", this.answerA);
                params.append("answerB", this.answerB);
                params.append("answerC", this.answerC);
                params.append("answerD", this.answerD);
                params.append("course", courid);
                params.append("parperid", this.parperid);
                params.append("score", this.score2);//分数
                params.append("sectionid", sessionid)


                //判断是否选中正确答案
                if (this.answerD != null && this.answerC != null && this.answerB != null && this.answerA != null && this.addrubric != null) {


                    if (this.form != true) {
                        axios({
                            method: 'post',
                            url: '/api/exam/Sectionrubric/addexamrubricdouble',
                            data: params,

                        }).then(res => {
                            res = res.data;
                            if (res.success) {

                                this.$notify({title: "成功", message: res.message, type: 'success'});
                                /*关闭对话框,清除表单*/
                                this.dialogVisible = false;
                                this.addrubric = '';
                                this.answerA = "";
                                this.answerB = "";
                                this.answerC = "";
                                this.answerD = "";
                                this.form = "";
                                this.typedan = "";
                                this.score2 = "";
                                this.query();
                                this.queryexam();


                            } else {
                                this.$notify.error({title: "失败", message: res.message})
                            }


                        })
                    } else {
                        this.$notify.error({title: "失败", message: "请选择正确答案"})
                    }
                }

                else {
                    this.$notify.error({title: "失败", message: "请填写完成试题信息"})
                }


            }
            ,

            /*新增多选题方法*/
            addrudicduo() {

                let params = new URLSearchParams();
                params.append("rubrictype", "多选题");
                params.append("userid", userid);
                params.append("answerid", this.duoform1 + this.duoform2 + this.duoform3 + this.duoform4);
                params.append("addrubric", this.duoaddrubric);
                params.append("answerA", this.duoanswerA);
                params.append("answerB", this.duoanswerB);
                params.append("answerC", this.duoanswerC);
                params.append("answerD", this.duoanswerD);
                params.append("course", courid);
                params.append("parperid", this.parperid);
                params.append("score", this.score2);//分数
                params.append("sectionid", sessionid)

                //判断是否选中正确答案
                if (this.duoanswerA != null && this.duoanswerB != null && this.duoanswerC != null && this.duoanswerD != null && this.duoaddrubric != null) {


                    if (this.duoform1 + this.duoform2 + this.duoform3 + this.duoform4 != true) {
                        axios({
                            method: 'post',
                            url: '/api/exam/Sectionrubric/addexamrubricdouble',
                            data: params,

                        }).then(res => {
                            res = res.data;
                            if (res.success) {
                                this.$notify({title: "成功", message: res.message, type: 'success'});
                                /*关闭对话框,清除表单*/
                                this.dialogVisibleduo = false;
                                this.duoaddrubric = "";
                                this.duoanswerA = "";
                                this.duoanswerB = "";
                                this.duoanswerC = "";
                                this.duoanswerD = "";
                                this.duoform1 = "";
                                this.duoform2 = "";
                                this.duoform3 = "";
                                this.duoform4 = "";
                                this.typeduo = "";
                                this.score2 = "";
                                this.query();
                                this.queryexam();

                            } else {
                                this.$notify.error({title: "失败", message: res.message})
                            }
                        })
                    } else {
                        this.$notify.error({title: "失败", message: "请选择正确答案"})
                    }
                }

                else {
                    this.$notify.error({title: "失败", message: "请填写完成试题信息"})
                }

            }
            ,

            /*新增填空题方法*/
            tkaddrudic() {
                let params = new URLSearchParams();
                params.append("rubrictype", "填空题");
                params.append("userid", userid);
                params.append("answerid", this.tkaddanswer);
                params.append("addrubric", this.tkaddrubric);
                params.append("course", courid);
                params.append("parperid", this.parperid);
                params.append("score", this.score2);//分数
                params.append("sectionid", sessionid)

                axios({
                    method: 'post',
                    url: '/api/exam/Sectionrubric/addexamrubricdouble',
                    data: params,

                }).then(res => {
                    res = res.data;
                    if (res.success) {
                        this.$notify({title: "成功", message: res.message, type: 'success'});
                        /*关闭对话框,清除表单*/
                        this.dialogVisibletk = false;
                        this.tkaddrubric = "";
                        this.tkaddanswer = "";
                        this.typebletk = "";
                        this.score2 = "";
                        this.query();
                        this.queryexam();
                    } else {
                        this.$notify.error({title: "失败", message: res.message})
                    }
                })
            }
            ,

            /*新增判断题方法*/
            pdaddrudic() {
                let params = new URLSearchParams();
                params.append("rubrictype", "判断题");
                params.append("userid", userid);
                params.append("addrubric", this.pdaddrubric);
                params.append("answerid", this.pdvalue3);
                params.append("course", courid);
                params.append("parperid", this.parperid);
                params.append("score", this.score2);//分数
                params.append("sectionid", sessionid)

                axios({
                    method: 'post',
                    url: '/api/exam/Sectionrubric/addexamrubricdouble',
                    data: params,

                }).then(res => {
                    res = res.data;
                    if (res.success) {
                        this.$notify({title: "成功", message: res.message, type: 'success'});
                        this.dialogVisiblepd = false;
                        this.pdvalue3 = false;
                        this.pdaddrubric = "";
                        this.typejudge = "";
                        this.score2 = "";
                        this.query();
                        this.queryexam();
                    } else {
                        this.$notify.error({title: "失败", message: res.message})
                    }
                })


            }
            ,

            /*选题取消*/
            addquxiao() {
                this.score1 = "";
                this.score = false;

            },

            /*新增取消按钮*/
            addquxiao() {

                this.addrubric = '';
                this.rubrictype1 = '';
                this.answerA = "";
                this.answerB = "";
                this.answerC = "";
                this.answerD = "";
                this.form = true;
                this.typejudge = "";
                this.typedan = "";
                this.typeduo = "";
                this.typebletk = "";

                this.pdaddrubric = "";
                this.pdvalue3 = false;
                this.tkaddrubric = "";
                this.tkaddanswer = "";


                this.duoaddrubric = "";
                this.duoanswerA = "";
                this.duoanswerB = "";
                this.duoanswerC = "";
                this.duoanswerD = "";
                this.duoform1 = "";
                this.duoform2 = "";
                this.duoform3 = "";
                this.duoform4 = "";
                this.dialogVisible = false;
                this.dialogVisibletk = false;
                this.dialogVisiblepd = false;
                this.dialogVisibleduo = false;
            },


            /*分页的每页条数*/
            handleSizeChange(val) {
                this.pagesize = val;
                console.log(this.pagesize)  //每页下拉显示数据
            }
            ,

            /*点击下面分页条的数字的时候调用*/
            handleCurrentChange() {
                this.currentPage = currentPage;
                console.log(this.currentPage)  //点击第几页
            }
            ,

            /*根据total:查询出的数据库的总共条数,进行分页条的划分*/
            created: function () {
                this.total = this.tableData.length;
            }
            ,

            /*点击分页条的数字,根据数字(页数)进行查询,根据每页的条数进行query()查询*/
            current_change: function (currentPage) {
                this.currentPage = currentPage;
                this.query();
            }
            ,

            current_changeexam: function (currentPage) {
                this.currentPage = currentPage;
                this.queryexam();
            }


        }


    })
</script>

</html>